package cn.highset.modules.base.service.mybatis;

import cn.highset.modules.base.entity.Country;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;
import java.util.Map;

/**
 * @author Victor
 */
@CacheConfig(cacheNames = "country")
public interface ICountryService extends IService<Country> {
    /**
     * 获取集合
     *
     * @return
     */
    @Cacheable()
    List<Map<String, Object>> countryList();

    /**
     * 通过id获取  名称
     *
     * @param countryId
     * @return
     */
    @Cacheable(key = "'getlabel:'+#countryId")
    String getLabelById(String countryId);

    /**
     * 通过id获取  名称
     *
     * @param label
     * @return
     */
    @Cacheable(key = "'getid:'+#label")
    String getIdByLabel(String label);
}
